package UseUtil_Test;

import util.jdbc_utils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


//存在SQL注入漏洞
public class Util_Test02 {
    public static void main(String[] args) throws SQLException {

        //获得Connection数据库对象
        Connection connection = jdbc_utils.get_connection();
        //执行SQL对象
        Statement statement = connection.createStatement();
        //查询，返回结果集
        ResultSet resultSet = statement.executeQuery("select * from `users`");

        while (resultSet.next()){
            System.out.println(resultSet.getObject("id"));
            System.out.println(resultSet.getObject("NAME"));
            System.out.println(resultSet.getObject("PASSWORD"));
            System.out.println(resultSet.getObject("email"));
            System.out.println(resultSet.getObject("birthday"));

            System.out.println("--------------------------------------------------------------");
        }


        //关闭close 释放连接
        jdbc_utils.release(connection,statement,null);


    }

}
